/*******************************************************************************************
*
*      THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
*      ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
*      THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
*      PARTICULAR PURPOSE.
*  
* ------------------------------------------------------------------------------
*    Utility.cpp - implement tool for debug info print and other common functions
* ------------------------------------------------------------------------------
*    Revision History
*    Date                  Author         Activity ID               Activity Headline
*    2009-06-18            CubeWang          none                     initial 
*******************************************************************************************/

#include "stdafx.h"
#include "LogUtility.h"


void PrintDebugString(const TCHAR *format, ... )
{
	va_list args;

	va_start(args, format);
#ifdef _LOG_

	FILE *fpLog;

	fpLog = fopen("DebugInfo.log", "a+");  // "a+" appends context to the end of the file.
	if (fpLog)
	{
		vfprintf(fpLog, format, args);
		fflush(fpLog);
		fclose(fpLog);
	}

#else
	vwprintf(/*stdout, */format, args);
#endif

	va_end(args);
	
}
